﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace B10.Models
{
    public class UserPageViewModel
    {
        public UserPageViewModel(UserPage page)
        {
            this.Page = page;
            this.Profile = page.UserProfile;
            PagesCount = new DatabaseRepository().GetActivePages()
                .Where(p => p.ProfileId == page.ProfileId).Count();
            CommentsCount = new DatabaseRepository().GetAll<Comment>()
                .Where(p => p.ProfileId == page.ProfileId).Count();
        }

        //public UserPageViewModel(UserPage page, UserProfile profile)
        //{
        //    this.Page = page;
        //    this.Profile = profile;
        //    PagesCount = new DatabaseRepository().GetActivePages()
        //        .Where(p => p.ProfileId == page.ProfileId).Count();
        //    CommentsCount = new DatabaseRepository().GetAll<Comment>()
        //        .Where(p => p.ProfileId == page.ProfileId).Count();
        //}

        //public UserPageViewModel(UserPage page, UserProfile profile, 
        //    IEnumerable<UserPage> additionalPages) :this(page,profile)
        //{
        //    this.AdditionalPages = additionalPages.ToList();
        //}

        //public List<UserPage> AdditionalPages { get; private set; }

        public int PagesCount { get; private set; }
        public int CommentsCount { get; private set; }
        public UserPage Page { get; set; }
        public UserProfile Profile { get; set; }

    }
}
